package com.siwei.mes.service.erp.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.siwei.mes.common.query.PageQuery;
import com.siwei.mes.entity.erp.Project;
import com.siwei.mes.mapper.erp.ProjectMapper;
import com.siwei.mes.service.erp.ProjectService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * ERP-工程(Project)表服务实现类
 *
 * @author linzi
 * @since 2024-07-30 15:30:33
 */
@Service
public class ProjectServiceImpl implements ProjectService {
    @Resource
    private ProjectMapper projectMapper;

    @Override
    public PageInfo<Project> getPage(PageQuery<Project, Project> query) {
        Project searchParam = query.getParams();
        return PageHelper.startPage(query.getPageNum(), query.getPageSize())
                .doSelectPageInfo(() -> projectMapper.getList(searchParam));
    }

    @Override
    public Project loadByProId(Integer proId) {
        return projectMapper.loadByProId(proId);
    }

    @Override
    public List<Project> getAll(Project entity) {
        return projectMapper.getList(entity);
    }
}
